﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour {
    public DataPoint currentPoint;
    public DataPoint target;
    public static Player Ins { get; private set; }
    public Vector3 Position {
        get {
            return transform.position;
        }
    }
    public List<int> inventory;
    private float energy = 5;
    private float liftSpeed = .8f;

    private void Awake() {
        Ins = this;
    }

    private void Update() {
        if(target != null) {
            if(Vector3.Distance(transform.position, target.transform.position) == 0) {
                energy -= 1;
                currentPoint = target;
                target = null;
                GameMgr.Ins.FinishMove();
            } else {
                transform.position = Vector3.MoveTowards(
                    transform.position,
                    target.transform.position,
                    liftSpeed
                );
            }
        }
    }

    public bool IsMove {
        get { return target != null; }
    }
}
